package org.smile.db.sql.page;


/**
 * MySQL分页方言
 * @author Administrator
 *
 */
public class MySQLDialectPage implements DialectPage {

	private String sql;
	
	public MySQLDialectPage(String sql){
		this.sql=sql;
	}
	public String getCountSql() {
		return "SELECT COUNT(*) FROM ("+sql+") COUNT_TABLE_T";
	}
	
	public String getDataSql(int page,int size) {
		int firstRow=(page-1)*size;
		int endRow=firstRow+size;
		return "SELECT * FROM("+sql+") DATA_TABLE_T LIMIT "+firstRow+","+endRow;
		
	}

}
